package leetcode.周赛.第249场;

import org.junit.Test;

import java.util.Arrays;

/**
 * @author ：zsy
 * @date ：Created 2021/7/11 10:30
 * @description：https://leetcode-cn.com/contest/weekly-contest-249/problems/concatenation-of-array/
 */
public class 数组串联 {

    @Test
    public void Test() {
        Solution solution = new Solution();
        System.out.println(solution.getConcatenation(new int[]{1, 2, 1}));

    }
    class Solution {
        public int[] getConcatenation(int[] nums) {
            int n = nums.length;
            int[] ans = Arrays.copyOf(nums, n * 2);
            for (int i = n; i < n * 2; i++) {
                ans[i] = ans[i - n];
            }
            return ans;
        }
    }
}
